load("@fbcode//quic:defs.bzl", "mvfst_cpp_library")

oncall("traffic_protocols")

mvfst_cpp_library(
    name = "quic_batch_writer",
    srcs = [
        "QuicBatchWriter.cpp",
        "QuicBatchWriterFactory.cpp",
        "QuicGsoBatchWriters.cpp",
    ],
    headers = [
        "QuicBatchWriter.h",
        "QuicBatchWriterFactory.h",
        "QuicGsoBatchWriters.h",
    ],
    deps = [
        "//quic/common:buf_accessor",
    ],
    exported_deps = [
        "//folly:network_address",
        "//folly:portability",
        "//folly/io:iobuf",
        "//quic:constants",
        "//quic/common/events:eventbase",
        "//quic/common/udpsocket:quic_async_udp_socket",
        "//quic/state:quic_state_machine",
    ],
)

mvfst_cpp_library(
    name = "quic_callbacks",
    srcs = [
    ],
    headers = [
        "QuicCallbacks.h",
    ],
    deps = [
    ],
    exported_deps = [
        "//quic/codec:types",
    ],
)

mvfst_cpp_library(
    name = "transport",
    srcs = [
        "QuicTransportBase.cpp",
    ],
    headers = [
        "QuicSocket.h",
        "QuicTransportBase.h",
    ],
    deps = [
        ":loop_detector_callback",
        ":quic_batch_writer",
        ":transport_helpers",
        "//folly:chrono",
        "//folly:scope_guard",
        "//quic/common:time_util",
        "//quic/congestion_control:pacer",
        "//quic/logging:qlogger_constants",
        "//quic/loss:loss",
        "//quic/state:pacing_functions",
        "//quic/state:simple_frame_functions",
        "//quic/state:state_functions",
        "//quic/state:stream_functions",
    ],
    exported_deps = [
        ":transport_lite",
        "//folly:exception_wrapper",
        "//folly:maybe_managed_ptr",
        "//folly:portability",
        "//folly/io:iobuf",
        "//quic:constants",
        "//quic:exception",
        "//quic/codec:types",
        "//quic/common:network_data",
        "//quic/common:optional",
        "//quic/common:small_collections",
        "//quic/common/events:eventbase",
        "//quic/common/events:quic_timer",
        "//quic/common/udpsocket:quic_async_udp_socket",
        "//quic/congestion_control:bandwidth",
        "//quic/congestion_control:congestion_controller_factory",
        "//quic/congestion_control:copa",
        "//quic/congestion_control:cubic",
        "//quic/congestion_control:newreno",
        "//quic/observer:socket_observer_container",
        "//quic/observer:socket_observer_types",
        "//quic/state:quic_connection_stats",
        "//quic/state:quic_priority_queue",
        "//quic/state:quic_state_machine",
        "//quic/state:quic_stream_utilities",
        "//quic/state:retransmission_policy",
    ],
)

mvfst_cpp_library(
    name = "transport_lite",
    srcs = [
        "QuicTransportBaseLite.cpp",
    ],
    headers = [
        "QuicSocketLite.h",
        "QuicTransportBaseLite.h",
    ],
    deps = [
        ":loop_detector_callback",
        "//quic/congestion_control:congestion_controller_factory",
        "//quic/congestion_control:ecn_l4s_tracker",
        "//quic/congestion_control:pacer",
        "//quic/flowcontrol:flow_control",
        "//quic/loss:loss",
        "//quic/state:pacing_functions",
        "//quic/state:stream_functions",
        "//quic/state/stream:stream",
    ],
    exported_deps = [
        ":quic_callbacks",
        ":transport_helpers",
        "//folly:maybe_managed_ptr",
        "//folly/io/async:async_transport_certificate",
        "//quic:exception",
        "//quic/codec:types",
        "//quic/common:looper",
        "//quic/common/udpsocket:quic_async_udp_socket",
        "//quic/handshake:transport_parameters",
        "//quic/state:quic_state_machine",
    ],
)

mvfst_cpp_library(
    name = "ack_scheduler",
    srcs = [
        "QuicAckScheduler.cpp",
    ],
    headers = [
        "QuicAckScheduler.h",
    ],
    exported_deps = [
        "//quic:constants",
        "//quic/state:quic_state_machine",
    ],
)

mvfst_cpp_library(
    name = "transport_helpers",
    srcs = [
        "IoBufQuicBatch.cpp",
        "QuicPacketScheduler.cpp",
        "QuicTransportFunctions.cpp",
    ],
    headers = [
        "IoBufQuicBatch.h",
        "QuicPacketScheduler.h",
        "QuicTransportFunctions.h",
    ],
    deps = [
        "//folly/tracing:static_tracepoint",
        "//quic/common:buf_accessor",
        "//quic/common:socket_util",
        "//quic/happyeyeballs:happyeyeballs",
        "//quic/state:ack_frequency_functions",
        "//quic/state:ack_handler",
        "//quic/state:simple_frame_functions",
    ],
    exported_deps = [
        ":ack_scheduler",
        ":quic_batch_writer",
        "//folly:expected",
        "//folly/lang:assume",
        "//quic:constants",
        "//quic:exception",
        "//quic/client:state_and_handshake",
        "//quic/codec:codec",
        "//quic/codec:pktbuilder",
        "//quic/codec:pktrebuilder",
        "//quic/codec:types",
        "//quic/common/udpsocket:quic_async_udp_socket",
        "//quic/flowcontrol:flow_control",
        "//quic/handshake:transport_parameters",
        "//quic/state:quic_state_machine",
        "//quic/state:state_functions",
        "//quic/state:stats_callback",
        "//quic/state:stream_functions",
    ],
    exported_external_deps = [
        "boost",
    ],
)

mvfst_cpp_library(
    name = "loop_detector_callback",
    headers = ["LoopDetectorCallback.h"],
    exported_deps = [
        "//quic:constants",
    ],
)

mvfst_cpp_library(
    name = "stream_async_transport",
    srcs = [
        "QuicStreamAsyncTransport.cpp",
    ],
    headers = [
        "QuicStreamAsyncTransport.h",
    ],
    deps = [
        "//folly/io:iobuf",
        "//quic/common/events:folly_eventbase",
    ],
    exported_deps = [
        ":transport",
        "//folly/io/async:async_transport",
        "//quic/common/events:eventbase",
    ],
)
